﻿using System;
using Castle.DynamicProxy;

namespace Aop.Autofac.Aspects
{
    public abstract class OnMethodBondedAspect : Attribute
    {
        internal bool IsJideException;

        protected OnMethodBondedAspect(bool isJideException = true)
        {
            IsJideException = isJideException;
        }

        public virtual void OnBeforeExecuting(IInvocation invocation) { }
        
        public virtual void OnExecuting(Action<IInvocation> invocation, IInvocation param)
        {
            invocation.Invoke(param);
        }

        public virtual void OnExecuted(IInvocation invocation) { }

        public virtual void OnExit(IInvocation invocation) { }

        public virtual void OnException(IInvocation invocation, Exception exception) { }
    }
}
